package com.itkaien.awareDemo;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.ServletContextAware;

public class Person implements ServletContextAware, BeanFactoryAware, ApplicationContextAware {
    @Override
    public void setServletContext(jakarta.servlet.ServletContext servletContext) {
        // 设置servletContext的属性
        servletContext.setAttribute("person", this);
        System.out.println("设置servletContext的属性");

    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {

        System.out.println("设置BeanFactory的属性");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

        System.out.println("设置ApplicationContext的属性");
    }
}
